load(
    "//tools:defaults.bzl",
    "extract_tokens",
    "markdown_to_html",
    "ng_project",
    "ng_web_test_suite",
    "sass_binary",
    "sass_library",
    "ts_project",
)

package(default_visibility = ["//visibility:public"])

sass_library(
    name = "m3",
    srcs = [
        "_m3-chip.scss",
    ],
    deps = [
        "//src/material/core/style:sass_utils",
        "//src/material/core/tokens:m3_utils",
    ],
)

sass_library(
    name = "m2",
    srcs = [
        "_m2-chip.scss",
    ],
    deps = [
        "//src/material/core/style:elevation",
        "//src/material/core/style:sass_utils",
        "//src/material/core/theming:_inspection",
        "//src/material/core/tokens:m2_utils",
    ],
)

sass_library(
    name = "theme",
    srcs = [
        "_chips-theme.scss",
    ],
    deps = [
        ":m2",
        "//src/material/core/theming",
        "//src/material/core/theming:_inspection",
        "//src/material/core/theming:_validation",
        "//src/material/core/tokens:token_utils",
        "//src/material/core/typography",
    ],
)

sass_binary(
    name = "chip_css",
    src = "chip.scss",
    deps = [
        ":m2",
        "//src/cdk:sass_lib",
        "//src/material/core/focus-indicators",
        "//src/material/core/style:layout_common",
        "//src/material/core/style:vendor_prefixes",
        "//src/material/core/tokens:token_utils",
    ],
)

sass_binary(
    name = "chip_set_css",
    src = "chip-set.scss",
    deps = ["//src/material/core/style:vendor_prefixes"],
)

ng_project(
    name = "chips",
    srcs = [
        "chip.ts",
        "chip-action.ts",
        "chip-edit-input.ts",
        "chip-grid.ts",
        "chip-icons.ts",
        "chip-input.ts",
        "chip-listbox.ts",
        "chip-option.ts",
        "chip-row.ts",
        "chip-set.ts",
        "chip-text-control.ts",
        "index.ts",
        "module.ts",
        "public-api.ts",
        "tokens.ts",
    ],
    assets = [
        "chip-option.html",
        "chip-row.html",
        "chip.html",
        ":chip_css",
        ":chip_set_css",
    ],
    deps = [
        "//:node_modules/@angular/animations",
        "//:node_modules/@angular/common",
        "//:node_modules/@angular/core",
        "//:node_modules/@angular/forms",
        "//:node_modules/rxjs",
        "//src:dev_mode_types",
        "//src/material/core",
        "//src/material/form-field",
    ],
)

ts_project(
    name = "chips_tests_lib",
    testonly = True,
    srcs = glob(
        ["**/*.spec.ts"],
        exclude = ["**/*.e2e.spec.ts"],
    ),
    deps = [
        ":chips",
        "//:node_modules/@angular/animations",
        "//:node_modules/@angular/common",
        "//:node_modules/@angular/core",
        "//:node_modules/@angular/forms",
        "//:node_modules/@angular/platform-browser",
        "//:node_modules/rxjs",
        "//src/cdk/a11y",
        "//src/cdk/bidi",
        "//src/cdk/keycodes",
        "//src/cdk/platform",
        "//src/cdk/testing",
        "//src/cdk/testing/private",
        "//src/material/core",
        "//src/material/form-field",
        "//src/material/input",
    ],
)

ng_web_test_suite(
    name = "unit_tests",
    deps = [
        ":chips_tests_lib",
    ],
)

markdown_to_html(
    name = "overview",
    srcs = [":chips.md"],
)

extract_tokens(
    name = "tokens",
    srcs = [":theme"],
)

filegroup(
    name = "source-files",
    srcs = glob(["**/*.ts"]),
)
